<%-- 
    Document   : index.jsp
    Created on : 2014-12-12, 23:36:05
    Author     : lzg
--%>
<%@page import="java.util.UUID"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    String uuid = UUID.randomUUID().toString();
    request.setAttribute("uuid", uuid);
    String sessionId=session.getId();
%>
	<a href="javascript:void(0)" class="btn btn-default addBt " id="selectAdminDivBt">
        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 选择行政区划
    </a>
    <ul id="selectedAdminDivs">
        
    </ul>

    <a href="javascript:void(0)" class="btn btn-default addBt " id="selectOrgBt">
        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 选择组织机构
    </a>
    <ul id="selectedOrgs">
        
    </ul>
    
    <a href="javascript:void(0)" class="btn btn-default addBt " id="selectUserBt">
        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 选择用户
    </a>
    <ul id="selectedUsers">
        
    </ul>
<script type="text/javascript">
    var attIds=[];
    $(function () {
        var selectedOrgs=$("#selectedOrgs");
        var selectedRows;
        $("#selectOrgBt").click(function(){
            webUtils.orgSelector({
                scope:this,
                hasSelectedOrgs:selectedRows,
                onSelect:function(rows){
                    selectedOrgs.html("");
                    $.each(rows,function(i,n){
                        selectedRows=rows;
                        selectedOrgs.append("<li>"+n.name+"</li>");
                    });
                }
            });
        });
        
        
        var selectedUsers=$("#selectedUsers");
        var selectedUserRows;
        $("#selectUserBt").click(function(){
            webUtils.userSelector({
                scope:this,
                hasSelectedUsers:selectedUserRows,
                onSelect:function(rows){
                    selectedUsers.html("");
                    $.each(rows,function(i,n){
                        selectedUserRows=rows;
                        selectedUsers.append("<li>"+n.userName+"</li>");
                    });
                }
            });
        });
        
        var selectedAdminDivs=$("#selectedAdminDivs");
        var selectedAdminDivRows;
        $("#selectAdminDivBt").click(function(){
        	webUtils.adminDivSelector({
                scope:this,
                initAdminDivs:wiseMen.platform.initProperties.adminDiv,
                hasSelectedAdminDivs:selectedAdminDivRows,
                onSelect:function(rows){
                	selectedAdminDivs.html("");
                    $.each(rows,function(i,n){
                    	selectedAdminDivRows=rows;
                        selectedAdminDivs.append("<li>"+n.name+":"+n.code+"</li>");
                    });
                }
            });
        });
        
    });
</script>